package cn.iocoder.yudao.module.api.promotion.gift.dto;

import cn.iocoder.yudao.framework.business.basic.pojo.vo.MerchantScopeVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  这里是文件说明
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/01/13
 */
@Data
public class GiftActivityVO extends MerchantScopeVO {

    @Schema(description = "赠品形式：0-线下产品、1-线上产品、2-优惠券", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
    private Integer type;
    private String typeName;

    @Schema(description = "产品SPU编号，赠品形式为线上产品时有效")
    private Long spuId;

    @Schema(description = "产品SKU编号，赠品形式为线上产品时有效")
    private Long skuId;

    @Schema(description = "优惠券模板编号，赠品形式为线上优惠券时有效")
    private Long couponTemplateId;

    @Schema(description = "合作方店铺编号")
    private List<Long> partnerShopIds;

    @Schema(description = "名称")
    private String name;

    @Schema(description = "图片")
    private String picUrl;

    @Schema(description = "原价，单位为分，0表示免费")
    private Integer originPrice;

    @Schema(description = "成本价格，单位为分，-1表示不显示价格，0表示免费，用于分账给赠品所属的商家")
    private Integer costPrice;

    @Schema(description = "库存")
    private Integer stock;

    public Integer getStock() {
        if (stock == null || stock < 0) {
            return 99999;
        }
        return stock;
    }

    @Schema(description = "限领数量")
    private Integer takeLimitCount;

    public Integer getTakeLimitCount() {
        if (takeLimitCount == null || takeLimitCount < 0) {
            return 99999;
        }
        return takeLimitCount;
    }

    @Schema(description = "已领数量")
    private int takeReceivedCount;

    @Schema(description = "单位，如：次、条、瓶、份")
    private String unit;

    @Schema(description = "生效时间")
    private LocalDateTime startTime;

    @Schema(description = "作废时间")
    private LocalDateTime endTime;

    @Schema(description = "是否生效")
    private Boolean valid;

    @Schema(description = "是否作废")
    private Boolean invalid;

    @Schema(description = "使用说明")
    private String note;

}
